<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib prefix="my" uri="http://www.trkj.com/tr1702/tags" %>
<html>
<script type="text/javascript"
	src="<c:url value="/js/jquery-easyui-1.5.5.6/jquery.min.js"/>"></script>
<script type="text/javascript"
	src="<c:url value="/js/jquery-easyui-1.5.5.6/jquery.easyui.min.js"/>"></script>
<script type="text/javascript"
	src="<c:url value="/js/jquery-easyui-1.5.5.6/locale/easyui-lang-zh_CN.js"/>"></script>
<link rel="stylesheet" type="text/css"
	href="<c:url value="/js/jquery-easyui-1.5.5.6/themes/default/easyui.css"/>" />
<link rel="stylesheet" type="text/css"
	href="<c:url value="/js/jquery-easyui-1.5.5.6/themes/icon.css"/>" />
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>培训课程列表</title>
	<style type="text/css">
		 
	</style>
</head>
<body>	
	<script type="text/javascript">
				var edit =function(row,value,index){
	 	<my:g id="95">
								var vv=$('#cf-traincourselist-tb').datagrid('getSelected');
								var d= $("#cf-traincourselist-starttime").textbox('getText');
								var f=$("#cf-traincourselist-endtime").textbox('getText');
					if(d!="" && f!=""){
					 $("<form method='get'>").appendTo(document.body).form({
							url:'Course_update',
							onSubmit:function(param){
								param['courseId'] =vv.courseId;
								param['stainId'] = $("#cf-traincourselist-sid").textbox('getValue');
								param['stainName'] =$("#cf-traincourselist-sname").textbox('getValue');
								param['courseMakeup'] =$("#cf-traincourselist-Makeup").textbox('getValue');
								param['courseStartime'] =$("#cf-traincourselist-starttime").textbox('getValue');
								param['courseEndtime'] =$("#cf-traincourselist-endtime").textbox('getValue');
								param['courseState'] =$("#cf-traincourselist-State").textbox('getValue');
							},
							success:function(){
								$('#cf-traincourselist-tb').datagrid('reload');
								$('#cf-traincourselist-win').dialog('close');
							}
						}).submit().appendTo(".abc");
					 return $(this).form('validate');
					}else{
						$.messager.alert('提示','考试时间和结束时间不能为空');
					}
				 </my:g>
				}
				var formatters =function(value,row,index){
					 <my:g id="94">
					var del="<a butn='tb_btn_del' onclick='delrow("+row.courseId+")'></a>";
					 </my:g>
					return del;
				}
				var delrow=function(courseId){
					$.messager.confirm("提示",'确定删除一行',function(v){
						if(v){
						 $.post("Course_remove",{courseId:courseId},function(){
							 $('#cf-traincourselist-tb').datagrid('reload');
						 });
						}
					});
				}
			$(function(){
				$("#cf-traincourselist-tb").datagrid({onLoadSuccess:function(){
				 $("a[butn=tb_btn_del]").linkbutton({iconCls:'icon-cancel', plain:true});
				}});
				//打开新增界面
				$("#cf-traincourselist-add").linkbutton({
					onClick : function() {
						$("#cf-traincourselist-win").dialog("open");
						$("#cf-traincourselist-f").form('clear');
						/* parent.$('.dialog-button a:eq(0)').show();
						parent.$('.dialog-button a:eq(1)').hide(); */
						$('#cf-pxkclb-1').show();
						$('#cf-pxkclb-2').hide();
					}
				});
				
				$("#cf-traincourselist-sid").textbox({
						icons:[{
							iconCls:'icon-man',
							handler:function(value){
								$("#cf-traincourselist-win1").dialog("open");
								 
							}
						}]
				});
				$("#cf-traincourselist-tb1").datagrid({onDblClickRow:function(){
					 var vv=$('#cf-traincourselist-tb1').datagrid('getSelected');
							$('#cf-traincourselist-sid').textbox('setValue',vv.stainId);
							$('#cf-traincourselist-sname').textbox('setValue',vv.stainName);
							$('#cf-traincourselist-win1').dialog('close');
				}});
				$("#cf-traincourselist-tb").datagrid({onDblClickRow:function(){
						$("#cf-traincourselist-f").form('clear');
						$("#cf-traincourselist-win").dialog("open");
						var vv=$('#cf-traincourselist-tb').datagrid('getSelected');
						$("#cf-traincourselist-cid").textbox('setValue',vv.courseId);
						$("#cf-traincourselist-sid").textbox('setValue',vv.stainId);
						$("#cf-traincourselist-sname").textbox('setValue',vv.stainName);
						//$("#cf-traincourselist-Makeup").textbox('setValue',vv.courseMakeup);
						//$("#cf-traincourselist-starttime").textbox('setValue',vv.courseStartime);
						//$("#cf-traincourselist-endtime").textbox('setValue',vv.courseEndtime);
						//$("#cf-traincourselist-State").textbox('setValue',vv.courseState);
						/* parent.$('.dialog-button a:eq(0)').hide();
						parent.$('.dialog-button a:eq(1)').show(); */
						$('#cf-pxkclb-1').hide();
						$('#cf-pxkclb-2').show();
				}});
				$("#cf-traincourselist-refresh").linkbutton({
					onClick : function() {
					$('#cf-traincourselist-tb').datagrid('reload');
					}
				});
			});
	</script>
	<div class="abc"></div>
	<div id="cf-traincourselist-tbs12">
   		 <my:g id="94"><a id="cf-traincourselist-add" class="easyui-linkbutton" data-options="iconCls:'icon-add',plain:true,text:'添加'"></a></my:g>
    	 <a id="cf-traincourselist-refresh" class="easyui-linkbutton" data-options="iconCls:'icon-reload',text:'刷新',plain:true,iconAlign:'right'"></a>
    	 <input id="cf-traincourselist-searchbox" class="easyui-searchbox" data-options="label:'搜索',width:300,labelWidth:50,prompt:'员工编号、姓名',
     	searcher:function(value,name){
	        $('#cf-traincourselist-tb').datagrid('load','Course_pages?stainName='+value);
     	 }">
  </div>
		<table id="cf-traincourselist-tb" class="easyui-datagrid" data-options="
			url:'Course_pages?stainName=',
			fitColumns:true,
			fit:true,
			nowrap:false,
			loading:true,
			pagination:true,
			rownumbers:true,
			singleSelect:true,
			pageSize:10,
    		pageList:[5,6,7,8,9,10],
			toolbar:'#cf-traincourselist-tbs12',
			striped:true,
			method:'get'	
	">
		<thead>
		  <tr>
			<th data-options="field:'courseId',width:150,align:'center'">培训课程ID</th>
			<!-- <th data-options="field:'password',width:150,align:'center'">活动编号</th>
			<th data-options="field:'sex',width:200,align:'center',
				styler:function(value,row,index){
					if(value==1){
						return 'color:white;background:red;';
					}
				},align:'center'
			">活动名称</th>
			<th data-options="field:'2',width:150,align:'center'">课程名称</th> 
			<th data-options="field:'courseaId',width:150,align:'center'">课程编号</th>-->
			<th data-options="field:'stainId',width:150,align:'center'">员工编号</th>
			<th data-options="field:'stainName',width:150,align:'center'">员工名</th>
			<th data-options="field:'courseMakeup',width:100,align:'center',
			formatter:function(value){
					if(value==0){
						return value='否';
					}else{return value='是';}
			},styler:function(value,row,index){
					if(value==1){
						return 'color:red;';
					}else{return 'color:#000000';}
				}">是否补考</th>
			<th data-options="field:'courseStartime',width:200,align:'center',
			formatter:function(value){
				var date = new Date(value);
                        var y = date.getFullYear();
                        var m = date.getMonth() + 1;
                        var d = date.getDate();
                        return y + '-' +m + '-' + d;
			}">考试实际开始日期</th>
			<th data-options="field:'courseEndtime',width:200,align:'center',
			formatter:function(value){
				var date = new Date(value);
                        var y = date.getFullYear();
                        var m = date.getMonth() + 1;
                        var d = date.getDate();
                        return y + '-' +m + '-' + d;
			}">考试实际结束时间</th>
			<th data-options="field:'courseState',width:100,align:'center',
			formatter:function(value,row,index){
					if(value==0){
						return value='O';
					}else{
					return value='X';}
			},styler:function(value,row,index){
					if(value==1){
						return 'color:red;';
					}else{return 'color:#000000';}
				}">状态</th>
			<th data-options="field:'9',width:50,align:'center',formatter:formatters">操作</th>
		  </tr>	
		</thead>
		<tbody>
		</tbody>
	</table>
	<div id="cf-traincourselist-win" style="font-size:13px" class="easyui-dialog"data-options="width:830,height:530,
			title:'新增:培训课程列表',
     		bodyCls:'Course_add',
      		modal:true,
      		closed:true,
      		buttons:[{
	        	text:'保存',
				id:'cf-pxkclb-1',
	        	iconCls:'icon-large-smartart',
				iconAlign:'left',
        		handler:function(){
          		 $('#cf-traincourselist-f').form({
            		onSubmit:function(param){
            		 //验证表单
             		 //return $(this).form('validate');
            		},
	           		 success:function(v){
	              		//$.messager.alert('提示','注册成功');
	              		$('#cf-traincourselist-win').dialog('close');
						$('#cf-traincourselist-tb').datagrid('reload');
	            	}
          	    }).submit();
       		  }
      		},{
        	text:'修改',
			id:'cf-pxkclb-2',
        	iconCls:'icon-mini-edit',
	        	handler:edit
			},{
        	text:'取消',
        	iconCls:'icon-cancel',
	        	handler:function(){
	          		$('#cf-traincourselist-win').dialog('close');
	        	}
			}
			]">
		<form id="cf-traincourselist-f" action="Course_add" method="get">
				<p>&nbsp;&nbsp;&nbsp;&nbsp;概要</p>
			<img src="/hr/images/CFlanxian20180903155415.jpg">
			<div style="float:left;margin-top:10px">
				<div class="line"style="margin-top:10px">
					        <input id="cf-traincourselist-cid" class="easyui-textbox" name="courseId"
						data-options="label:'培训课程ID',width:240">
				</div>
				<div class="line"style="margin-top:10px">
					        <input id="cf-traincourselist-sid" class="easyui-textbox" name="stainId"
						data-options="label:'员工名',width:200">
					 
						<input id="cf-traincourselist-sname" class="easyui-textbox" name="stainName"
						data-options="width:100,readonly:true,required:true">
				</div>
				<div class="line" style="margin-top:10px;margin-left:35px">
					<!-- <input id="cf-traincourselist-ids" class="easyui-textbox" name=""data-options="label:'合格分数线',width:340"> -->
					<select id="cf-traincourselist-Makeup" class="easyui-combobox" name="courseMakeup"
							 data-options="label:'是否补考',width:200,panelHeight:'auto',editable:false">   
							    <option value="0">否</option>   
							    <option value="1">是</option>   
					</select>
				</div>
				 
			</div>
			<div style="float:right;margin-right:108px;margin-top:10px">
				
				<div class="line"style="margin-top:10px">
					        考试开始时间&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					<input id="cf-traincourselist-starttime" class="easyui-datetimebox" name="courseStartime"
						data-options="width:125,editable:false,required:true">
				</div>
				<div class="line"style="margin-top:10px">
					        考试结束时间&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					<input id="cf-traincourselist-endtime" class="easyui-datetimebox" name="courseEndtime"
						data-options="width:125,editable:false,required:true">
				</div>
				<div class="line"style="margin-top:10px;margin-left:35px">
					<!-- <input id="cf-traincourselist-ids" class="easyui-textbox" name=""data-options="label:'考场安排号',width:200"> -->
					<select id="cf-traincourselist-State" class="easyui-combobox" name="courseState"
							 data-options="label:'状态',width:200,panelHeight:'auto',editable:false">   
							    <option value="0">可用</option>   
							    <option value="1">不可用</option>   
							</select>
				</div>
			</div>
			<div style="float:left">
				<p>&nbsp;&nbsp;&nbsp;&nbsp;地址</p>
					<img style="margin-bottom:10px" src="/hr/images/CFlanxian20180903155415.jpg">
				<input id="cf-traincourselist-site" class="easyui-textbox"
				 data-options="multiline:true,width:790,height:70">
				<p>&nbsp;&nbsp;&nbsp;&nbsp;行程</p>
					<img style="margin-bottom:10px" src="/hr/images/CFlanxian20180903155415.jpg">
				<input id="cf-traincourselist-xc" class="easyui-textbox"
				 data-options="multiline:true,width:790,height:70">
				<p>&nbsp;&nbsp;&nbsp;&nbsp;备注</p>
					<img style="margin-bottom:10px" src="/hr/images/CFlanxian20180903155415.jpg">
				<input id="cf-traincourselist-remark" class="easyui-textbox"
				 data-options="multiline:true,width:790,height:70">
			</div>
		</form>
	</div>
		<div id="cf-traincourselist-win1" style="font-size:13px" class="easyui-dialog"data-options="width:500,height:300,
			title:'清单查询-员工',
     		bodyCls:'Course_pages_yg1',
      		modal:true,
      		closed:true,
      		buttons:[{
	        	text:'确定',
	        	iconCls:'icon-ok',
				iconAlign:'left',
        		handler:function(row){
	          		  var vv=$('#cf-traincourselist-tb1').datagrid('getSelected');
					if(vv){
						$('#cf-traincourselist-sid').textbox('setValue',vv.stainId);
						$('#cf-traincourselist-sname').textbox('setValue',vv.stainName);
						$('#cf-traincourselist-win1').dialog('close');
       		   		}else{
						$.messager.alert('提示','请选择一行');
					}
				}
      		},{
        	text:'取消',
        	iconCls:'icon-cancel',
	        	handler:function(){
	          		$('#cf-traincourselist-win1').dialog('close');
	        	}
			}
			]">
		 <table id="cf-traincourselist-tb1" class="easyui-datagrid" data-options="
			url:'Course_pages_yg1',
			fitColumns:true,
			fit:true,
			nowrap:false,
			loading:true,
			pagination:false,
			rownumbers:true,
			singleSelect:true,
			method:'get'	
	">
		<thead>
			  <tr>
				<th data-options="field:'stainId',width:150,align:'center'">员工编号</th>
				<th data-options="field:'stainName',width:150,align:'center'">员工名</th>
			  </tr>	
			</thead>
			<tbody>
			</tbody>
	</table>
	</div>
</body>
</html>